const Koa = require('koa');
const compress = require('koa-compress');
const fs = require('fs');
const app = new Koa();



app.use(async (ctx,next) => {
    ctx.type = 'text/html';
    ctx.body = fs.readFileSync('index.html');
    await next();

})

app.use(compress({
    filter:function(content_type) {
        return /text/i.test(content_type);
    },
    threshold:1024,
    gzip:{
        flush:require('zlib').constants.Z_SYNC_FLUSH
    },
    br: false 
}))


app.listen(1314,() => {
    console.log('http://localhost:1314');
})

